#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
typedef pair<int, int> PII;
#define x first
#define y second
const int N = 550;
char mp[N][N];
bool st[N][N];
int n, m;
queue<PII>q;
int dx[] = { -1,0,1,0 };
int dy[] = { 0,1,0,-1 };	
bool flag;
bool bfs(int x, int y, int ans1, int ans2)
{
	q.push({ x,y });
	st[x][y] = 1;
	while (q.size()) {
		PII t = q.front();
		q.pop();
		int x1 = t.x;
		int y1 = t.y;
		if (x1 == ans1 && y1 == ans2) {
			return 1;
		}
		for (int i = 0; i < 4; i++) {
			int a = x1 + dx[i];
			int b = y1 + dy[i];
			if (mp[a][b] == '#' || st[a][b] || a < 0 || b < 0 || a >= n || b >= m) {
				continue;
			}
			st[a][b] = 1;
			q.push({ a,b });
		}
	}
	return 0;
}

void dfs(int x, int y, int ans1, int ans2)
{
	if (x == ans1 && y == ans2) {
		flag = 1;
		return;
	}
	st[x][y] = 1;
	for (int i = 0; i < 4; i++) {
		int a = x + dx[i];
		int b = y + dy[i];
		if (mp[a][b] == '#' || st[a][b] || a < 0 || b < 0 || a >= n || b >= m) {
			continue;
		}
		dfs(a, b, ans1, ans2);
	}
}
int main()
{
	while (cin >> n >> m) {
		memset(st, 0, sizeof(st));
		memset(mp, 0, sizeof(mp));
		while (q.size()) {
			q.pop();
		}
		flag = 0;
		int x, y, x1, y1;
		for (int i = 0; i < n; i++) {
			cin >> mp[i];
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (mp[i][j] == 'S') {
					x = i;
					y = j;
				}
				if (mp[i][j] == 'E') {
					x1 = i;
					y1 = j;
				}
			}
		}
		dfs(x, y, x1, y1);
		if (flag) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		/*if (bfs(x, y, x1, y1)) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}*/
	}
	return 0;
}